package adminDynamicFieldHandler

import (
	exampleDtoApiPbAdminDynamicField "gitee.com/krio/ginc/example/dto/api/pb/admin/dynamic_field"
	adminDynamicFieldService "gitee.com/krio/ginc/example/internal/admin/dynamic/field/service"
	"github.com/gin-gonic/gin"
)

// DynamicFieldList 列表
func DynamicFieldList(ctx *gin.Context, req *exampleDtoApiPbAdminDynamicField.DynamicFieldListReq) (*exampleDtoApiPbAdminDynamicField.DynamicFieldListResp, error) {
	data, err := adminDynamicFieldService.DynamicFieldList(ctx, req)
	if err != nil {
		return nil, err
	}
	return data, nil
}

// DynamicFieldDetail 详情
func DynamicFieldDetail(ctx *gin.Context, req *exampleDtoApiPbAdminDynamicField.DynamicFieldDetailReq) (*exampleDtoApiPbAdminDynamicField.DynamicFieldInfo, error) {
	data, err := adminDynamicFieldService.DynamicFieldDetail(ctx, req)
	if err != nil {
		return nil, err
	}
	return data, nil
}

// DynamicFieldAdd 新增
func DynamicFieldAdd(ctx *gin.Context, req *exampleDtoApiPbAdminDynamicField.DynamicFieldInfo) (*exampleDtoApiPbAdminDynamicField.DynamicFieldAddResp, error) {
	data, err := adminDynamicFieldService.DynamicFieldAdd(ctx, req)
	if err != nil {
		return nil, err
	}
	return data, nil
}

// DynamicFieldUpdate 修改
func DynamicFieldUpdate(ctx *gin.Context, req *exampleDtoApiPbAdminDynamicField.DynamicFieldInfo) (*exampleDtoApiPbAdminDynamicField.DynamicFieldAddResp, error) {
	data, err := adminDynamicFieldService.DynamicFieldUpdate(ctx, req)
	if err != nil {
		return nil, err
	}
	return data, nil
}

// DynamicFieldDelete 删除
func DynamicFieldDelete(ctx *gin.Context, req *exampleDtoApiPbAdminDynamicField.DynamicFieldDeleteReq) (*exampleDtoApiPbAdminDynamicField.DynamicFieldDeleteResp, error) {
	data, err := adminDynamicFieldService.DynamicFieldDelete(ctx, req)
	if err != nil {
		return nil, err
	}
	return data, nil
}
